/*
 * Copyright 2007 Agile Plugins Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.googlecode.agileplugins.monkey;

public class StringUtil {
    public static String lcFirst(String text) {
        if (text == null) {
            return null;
        }
        if (text.endsWith("[]")) {
            text = text.substring(0, text.length() - 2) + "s";
        }
        if (text.length() == 0) {
            return "";
        }
        if (text.charAt(0) >= 'a' && text.charAt(0) <= 'z') {
            return text + "Value";
        }
        return text.substring(0, 1).toLowerCase() + text.substring(1);
    }

    public static String prefix(String prefix, String text) {
        if (text == null) {
            return prefix;
        }
        if (prefix == null) {
            return text;
        }
        return prefix + text.substring(0, 1).toUpperCase() + text.substring(1);
    }
}
